<template>
    <mt-loadmore :top-method="loadTop" ref="loadmore">
      <!-- <div class="list"> -->
        <div>
          <detail-banner :sightName='sightName' :bannerImg='bannerImg' :bannerImgs='gallaryImgs'></detail-banner>
          <detail-header></detail-header>
          <div class="content">
            <detail-list :list='list'></detail-list>
          </div>
          <div class="content">
            <detail-list :list='list'></detail-list>
          </div>
        </div>
      <!-- </div> -->
    </mt-loadmore>
</template>
<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import axios from 'axios'

export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      list: [],
      id: ''
    }
  },
  methods: {
    loadTop () {
      this.$refs.loadmore.onTopLoaded()
    },
    getDetailInfo () {
      // ?id=' + this.$route.params.id
      axios.get('/api/detail.json', {params: {id: this.$route.params.id}}).then(this.getDetailInfoSucc)
      this.id = (this.$route.params.id).toString()
      // console.log(this.id)
    },
    getDetailInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data[this.id]
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.list = data.categoryList
      }
    }
  },
  mounted () {
    this.getDetailInfo()
    // this.scroll = new Bscroll(this.$refs.wrapper, {click: true, probeType: 3, listenScroll: true})
  }
}
</script>
<style lang='stylus' scoped>
  // .list
  //   overflow: hidden
  //   position: absolute
  //   top: 0
  //   left: 0
  //   right: 0
  //   bottom: 0
  // .content
  // //  height: 20rem
</style>
